package 笔试.荣耀;

import java.util.*;

public class Demo03 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        //Map<String, List<Integer>> map = new HashMap<>();
        //int[][] scores = new int[10][3];
        boolean[] flag = new boolean[10];
        //int[] sum = new int[10];
        student[] students = new student[10];
        for(int i=0;i<10;i++){
            String tmp = in.nextLine();
            String[] strs = tmp.split(" ");

            List<Integer> list = new ArrayList<>();
            int total = 0;
            for(int j=1;j<4;j++){
                int score = Integer.valueOf(strs[j]);
                total += score;
                list.add(score);
                if(score<60) flag[i] = true;
            }
            students[i] = new student(strs[0],list.get(0),list.get(1),list.get(2),total);

        }
        //排序
        Arrays.sort(students,(a,b)->{
           if(a.getSum()==b.getSum()){
               if(a.getChineseScore() == b.getChineseScore()){
                   if(a.getMathScore()==b.getMathScore()){
                       return b.getEnglishScore()-a.getEnglishScore();
                   }else{
                       return b.getMathScore()-a.getMathScore();
                   }
               }else{
                   return b.getChineseScore()-a.getChineseScore();
               }
           }else{
              return b.getSum()-a.getSum();
           }
        });


        System.out.println("[First round name list]");
        //合格，分数从大到小排列，大于60
        for(int i=0;i<10;i++){
            if(students[i].getChineseScore()>=60 && students[i].getMathScore()>=60 && students[i].getEnglishScore()>=60)
            System.out.println(students[i].getName()+" "+students[i].getChineseScore()+" "+students[i].getMathScore()+" "+students[i].getEnglishScore());
        }

        //录取，取分数的前三名（包含相等）
        System.out.println("[Final name list]");


    }

    static class student{
        String name;
        int chineseScore;
        int mathScore;
        int englishScore;
        int sum;

        public student(String name, int chineseScore, int mathScore, int englishScore, int sum) {
            this.name = name;
            this.chineseScore = chineseScore;
            this.mathScore = mathScore;
            this.englishScore = englishScore;
            this.sum = sum;
        }

        public String getName() {
            return name;
        }

        public int getChineseScore() {
            return chineseScore;
        }

        public int getMathScore() {
            return mathScore;
        }

        public int getEnglishScore() {
            return englishScore;
        }

        public int getSum() {
            return sum;
        }
    }
}
